define(function (require,exports,module){
	require('jupload');

	require('jtemplate');
	require('jdialog');
	common = require('common');

	exports.init = function(configs){
		common.bswitctListInit(configs);
		//批量操作
		$(".inner-container [data-act='operateAll']").on("click",".js-deletes",function(){
			common.list_bacth_delete();
		});

		$(".inner-container [data-act='operateAll']").on("click",".js-of",function(){
			exports.list_bacth_of();
		});

		$(".inner-container [data-act='operateAll']").on("click",".js-on",function(){
			exports.list_bacth_on();
		});
		//批量禁用
		exports.list_bacth_of=function(){
			var url = '/admin/brand/setStatus?status=0';
			var __confirm = JDialog.win.work({
				title: "禁用",
				width: 340,
				height: 180,
				borderWidth: 8,
				lock: true,
				effect: 0,
				content: '<div style="padding-top: 15px;">确定要批量禁用这些记录吗？</div>',
				icon: 'warn',
				button: {
					'确认': function () {
						$.post(url, $("#J_List_Form").serialize(), function (data) {
							__confirm.close();
							if (data.code == "000") {
								JDialog.tip.work({type: "ok", content: data.message, timer: 1000});
								setTimeout(function () {
									location.reload();
								}, 1000)
							} else {
								JDialog.tip.work({type: "error", content: data.message, timer: __global.jdialog.timer});
							}
						}, "json");
					},
					'取消': function () {
						__confirm.close();
					}
				}

			});


		};
		//批量启用
		exports.list_bacth_on=function(){
			var url = '/admin/brand/setStatus?status=1';
			var __confirm = JDialog.win.work({
				title: "启用",
				width: 340,
				height: 180,
				borderWidth: 8,
				lock: true,
				effect: 0,
				content: '<div style="padding-top: 15px;">确定要批量启用这些记录吗？</div>',
				icon: 'warn',
				button: {
					'确认': function () {
						$.post(url, $("#J_List_Form").serialize(), function (data) {
							__confirm.close();
							if (data.code == "000") {
								JDialog.tip.work({type: "ok", content: data.message, timer: 1000});
								setTimeout(function () {
									location.reload();
								}, 1000)
							} else {
								JDialog.tip.work({type: "error", content: data.message, timer: __global.jdialog.timer});
							}
						}, "json");
					},
					'取消': function () {
						__confirm.close();
					}
				}

			});
		};


};
});
